package com.jdplat.jdm.web.service.system.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.jdplat.jdm.core.web.service.impl.BaseServiceImpl;
import com.jdplat.jdm.web.service.system.ISystemRoleService;
/**
 * SystemRoleServiceImpl
 * @author qirp
 *
 */
@Service
public class SystemRoleServiceImpl extends BaseServiceImpl implements ISystemRoleService{

	public List<Map<String, Object>> getUserRoles(String userid) {
		List<Map<String, Object>> userRoles = getDao().queryForList("systemRole_space.getUserRoles", userid);
		if(userRoles.size() > 0){
			return userRoles;
		}else
		    return null;
	}

	public List<Map<String, Object>> getRolePermissions(String id) {
		List<Map<String, Object>> rolePermissions = getDao().queryForList("systemRole_space.getRolePermissions", id);
		if(rolePermissions.size() > 0){
			return rolePermissions;
		}else
		    return null;
	}

	public void deleteRolePermission(String roleId) {
		if(roleId != null || "".equals(roleId)){
			getDao().delete("systemRole_space.deleteRolePermission", roleId);
		}
	}

}
